<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

/**
 * Protoweb class for handling messages
 */
class PwMsgHandler
{
    public  $error;
    public  $warning;
    public  $info;
    public  $success;
    private $CI;
    
    public function __construct()
    {
        $this->CI =& get_instance();
        $this->CI->load->library('session');

        $this->error   = ($this->CI->session->flashdata('error')   ? $this->CI->session->flashdata('error')   : '');
        $this->warning = ($this->CI->session->flashdata('warning') ? $this->CI->session->flashdata('warning') : '');
        $this->info    = ($this->CI->session->flashdata('info')    ? $this->CI->session->flashdata('info')    : '');
        $this->success = ($this->CI->session->flashdata('success') ? $this->CI->session->flashdata('success') : '');
    }

    public function persistError()
    {
        $this->CI->session->set_flashdata('error',$this->error);   
    }

    public function persistWarning()
    {
        $this->CI->session->set_flashdata('warning',$this->warning);   
    }

    public function persistInfo()
    {
        $this->CI->session->set_flashdata('info',$this->info);   
    }

    public function persistSuccess()
    {
        $this->CI->session->set_flashdata('success',$this->success);   
    }
} // class PwMsgHandler

/* End of file PwMsgHandler.php */
/* Location: ./application/libraries/PwMsgHandler.php */